package com.oak.broke.model.vip.v1;

import com.oak.broke.group.Update;
import com.oak.broke.model.vip.service.IVipApplyUserService;
import com.oak.broke.model.vip.base.ResponseMessage;
import com.oak.broke.model.vip.dto.VipApplyDTO;
import com.oak.broke.model.vip.entity.VipApplyUserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * vip申请用户
 *
 * @author guoxy
 * @email broke@gmail.com
 * @date 2023-05-18 10:37:20
 */
@Api(value = "vipApplyUser")
@RestController
@RequestMapping("/api/v1/vip/applyUser")
public class VipApplyUserV1Api {
    @Autowired
    private IVipApplyUserService vipApplyUserService;

    @ApiOperation("查询所有会员申请详情")
    @PostMapping("/list")
    public ResponseMessage<List<VipApplyUserEntity>> listVipApply(@RequestBody VipApplyDTO dto) {
        return ResponseMessage.success(vipApplyUserService.vipApplyUserList(dto));
    }

    @ApiOperation("保存会员申请办结")
    @PostMapping("/save")
    public ResponseMessage save(@Validated(value = {Update.class}) @RequestBody List<VipApplyDTO> list) {
        vipApplyUserService.saveApplyUser(list);
        return ResponseMessage.success();
    }

}
